package demo.java.parallelprogram.threadpool.threadpoolexecutor;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import demo.java.parallelprogram.threadpool.MyThread;

public class MyThreadPoolExecutor extends ThreadPoolExecutor {

	public MyThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
			BlockingQueue<Runnable> workQueue) {
		super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
	}

	protected void beforeExecute(Thread t, Runnable r) {
		System.out.println("beforeExecute MyThread Name:"+((MyThread)r).getName()+"TID:"+t.getId());
	}
	
	protected void afterExecute(Runnable r, Throwable t) {
		System.out.println("afterExecute TID:"+Thread.currentThread().getId());
		System.out.println("afterExecute PoolSize:"+this.getPoolSize());
		
	}
	
}
